package cn.caojun.auth.annotation.listener;

import cn.caojun.auth.service.IPermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class InitDataListener implements ServletContextListener {
    @Autowired
    private IPermissionScanService permissionScanService;

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent){
        System.out.println("*****************初始化开始*****************");
        permissionScanService.scan();
        System.out.println("*****************初始化结束*****************");

    }
    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent){
        System.out.println("*****************容器已销毁*******************");
    }
}
